import request from '@/utils/request'

const api_url = 'sign-records'


export default {
  //签到
  signIn(date?: string) {
    return request({
      url: `${api_url}`,
      method: 'post',
      data: { date }
    }).then(res =>{
        return res.data
    })
  },
  //获取当月签到记录
  getRecord(year?: number, month?: number) {
    return request({
      url: `${api_url}`,
      method: 'get',
      params: { year, month }
    })
  },
  //获取用户总积分
  getPoints() {
    return request({
      url: `${api_url}/total`,
      method: 'get',
    })
  },
  //补签
  signRepair(date: string) {
    return request({
      url: `${api_url}/repair`,
      method: 'post',
      params: { date }
    })
  },
}